extends Reference

func get_battle():
    return Global.Battle
func get_cardSystem():
    return Global.CardSystem
func dhAdd(donghua):
    get_battle().donghuaList.append(donghua)    
    pass
func getEnemys():
    return Global.Battle.enemys
func getPlayers():
    return Global.Battle.players
func dh_camShake():
    dhAdd({action="camShake"})
func dh_hit(dh,chess,dmg):
    dhAdd({action="hit",chess=chess,dmg=dmg})
func die(chess):
    chess.die=true
    Global.Battle.removeChess(chess)
    dhAdd({action="die",chess=chess})
func wait(time):
    dhAdd({action="wait",time=time})
func dh_forward(dh,chess):
    dhAdd({action="forward",chess=chess})
func VETarget(dh,ve,target,isWait=false):
    dhAdd({action="VETarget",VE=ve,target=target,isWait=isWait})
func draw():
    Global.CardSystem.draw()
func gainEnergy(number=1):
    Global.CardSystem.energy+=number
func discardRandom():
    Global.CardSystem.discardRandom()
func VEPoint(ve,point,isWait=false):
    dhAdd({action="VEPoint",VE=ve,point=point,isWait=isWait})
func setProperty(chess,property,value):
    chess.set(property,value)
    dhAdd({action="setProperty",chess=chess,property=property,value=value})
func setPropertyDH(chess,property,value):
    dhAdd({action="setProperty",chess=chess,property=property,value=value})
func gainProperty(chess,property,gainValue):
    var value=chess.get(property)+gainValue
    chess.set(property,value)
    dhAdd({action="setProperty",chess=chess,property=property,value=value})
func reduceProperty(chess,property,reduceValue):
    var value=chess.get(property)-reduceValue
    chess.set(property,value)
    dhAdd({action="setProperty",chess=chess,property=property,value=value})
func gainArmor(chess,armor):
    chess.armor+=armor
    setProperty(chess,"armor",chess.armor)
func setHp(chess,hp):
    if hp>chess.maxHp:
        hp=chess.maxHp
    setProperty(chess,"hp",hp)
    if chess.hp<=0:
        die(chess)
